﻿// <copyright file="RealmSpellsOwner.cs" company="Gravity Age Studios">
// Code released under the MIT license (see License.txt).
// </copyright>
// <author>Vicente Cartas Espinel</author>
// <email>vicente.cartas@gmail.com</email>
namespace LightSwitchApplication
{
    using Microsoft.LightSwitch.Presentation.Extensions;

    public partial class RealmSpellsOwner
    {
        #region Edit RealmSpell

        partial void gridEditSelected_CanExecute(ref bool result)
        {
            result = this.Collection.SelectedItem != null;
        }

        partial void gridEditSelected_Execute()
        {
            this.FindControl("ModalWindowRealmSpell").DisplayName = string.Format("Edit {0}", this.Collection.SelectedItem.Name);
            this.OpenModalWindow("ModalWindowRealmSpell");
        }

        partial void SubmitModalWindowRealmSpell_Execute()
        {
            this.CloseModalWindow("ModalWindowRealmSpell");
        }

        partial void CancelModalWindowRealmSpell_Execute()
        {
            this.CloseModalWindow("ModalWindowRealmSpell");
            this.Collection.SelectedItem.Details.DiscardChanges();
        }

        #endregion
    }
}
